using UnityEngine.UI;

namespace Gj
{
    public class BadgeHelper : NodeHelper
    {
        public Text Text;

        protected override BindDataType bindDataType => BindDataType.Int;

        protected override void BindData(int i)
        {
            if (i == 0)
                gameObject.SetActive(false);
            else
                gameObject.SetActive(true);

            if (Text != null)
            {
                var text = i > 99 ? "99+" : i.ToString();
                if (text.Equals(Text.text)) return;
                Text.text = text;
            }
        }
    }
}